﻿using dz.u9.jky.schema.Common;
using UFSoft.UBF.MVC;

namespace dz.inner.jky.api
{
    public class DzBaseController : OpenAPIController
    {
        protected LogUtils logger = new LogUtils();
        protected InnerUtil util = new InnerUtil();
        

        protected CommonDoc ToCommonDoc(U9CResult result)
        {
            CommonDoc rtn = new CommonDoc();

            rtn.DocNo = result.DocNo;
            rtn.ID = result.Id;

            return rtn;
        }

        protected U9CResult ToU9CResult(CommonDoc doc)
        {
            U9CResult rtn = new U9CResult();

            rtn.DocNo = doc.DocNo;

            rtn.Id = (doc.ID == 0) ? GetId(doc.DocNo) : doc.ID;
            

            return rtn;
        }

        protected virtual long GetId(string code)
        {
            return 0;
        }
    }
}
